<?php
class CmsFormatter extends CFormatter {

	public $dateFormat='Y-m-d H:i:s';

	protected static $_instance = null;
	
	public function formatShortDate($value) {
		$t = strtotime($value);
		return date('Y M d', $t);
	}

	public function formatDate($value) {
		$t = strtotime($value);
		return date('Y M d - l, g:i A', $t);
	}
	
	public function formatTime($value) {
		$t = strtotime($value);
		return $t ? date('Y/m/d H:i', $t) : '';
	}
	
	public function formatBoolean($value) {
		return $value ? '&bull;' : '';
	}

	public function formatEnum($value, array $data) {
		return isset($data[$value]) ? $data[$value] : '';
	}

	public function getYesNoStatusData() {
		return array(
			1 => Yii::t('app', 'Yes'),
			0 => Yii::t('app', 'No'),
		);
	}

	public function formatYesNo($value) {
		return $this->formatEnum($value, $this->getYesNoStatusData());
	}
}